
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_SinhVien_showAllSinhVien]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[sp_SinhVien_showAllSinhVien]
GO
create procedure sp_SinhVien_showAllSinhVien
	@IndexStart int,
	@Total int,
	@MaSV	varchar(10)
as
begin			
		
		
		With [USER] As (
				SELECT ROW_NUMBER() OVER(ORDER BY SinhVien.MaSV) AS RowNum,SinhVien.MaSV,SinhVien.Ten_SV,SinhVien.Ngay_Sinh,SinhVien.Gioi_Tinh,SinhVien.Dia_Chi 
				FROM SinhVien )
		DELETE
		FROM DangKy 
		WHERE MaSV = @MaSV

		DELETE
		FROM ThanhVien 
		WHERE MaSV = @MaSV	

		DELETE
		FROM SinhVien 
		WHERE MaSV = @MaSV	

		SELECT * FROM [USER] 
		WHERE RowNum BETWEEN @IndexStart AND @Total
	
end


--execute sp_QLTB_GetNhaCungCapByTen 2,11,'%%'

